﻿#ifndef __CMYLOCK_H__
#define __CMYLOCK_H__

#ifndef _WIN32
#include <pthread.h>
#else
#include <windows.h>
#endif

class ILock
{
public:
	virtual ~ILock() {};
	virtual void Lock() const = 0;
	virtual void UnLock() const = 0;
};

class CLock : public ILock
{
public:
	CLock();
	~CLock();

	virtual void Lock() const;
	virtual void UnLock() const;

private:
#ifndef _WIN32
	mutable pthread_mutex_t m_mutex;
#else
	HANDLE m_mutex;
#endif
};

class CMyLock
{
public:
	CMyLock(const ILock&);
	~CMyLock();

private:
	const ILock& m_lock;
};
#endif